<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<input type="button" value="添加美女图片" onclick="f()">
<script>
    //创建一个h1标签
    let h = document.createElement("h1");
    h.innerText = "这是h1";
    //添加到body里面
    // let body = document.querySelector("body");
    document.body.append(h);
    function f() {
        //创建一个img并且添加到页面中
        let img = document.createElement("img");
        img.src = "../b.jpg";
        img.width = 100;
        document.body.append(img);
    }



</script>
</body>
</html>